﻿using BrightSword.LightSaber;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Test.LightSaber
{
    /// <summary>
    ///This is a test class for StackFrameTest and is intended
    ///to contain all StackFrameTest Unit Tests
    ///</summary>
    [TestClass]
    public class StackFrameTest
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        /// <summary>
        ///A test for Push
        ///</summary>
        [TestMethod]
        public void StackFrameItemTest()
        {
            var target = new CallStack();

            var frame = target.PushFrame();
            frame["bottom"] = "bottom";
            frame["hidden"] = "bottom";

            frame = target.PushFrame();
            frame["top"] = "top";
            frame["hidden"] = "top";

            Assert.AreEqual(target["hidden"], "top");
            Assert.AreEqual(target["bottom"], "bottom");
            Assert.AreEqual(target["top"], "top");
            Assert.AreEqual(target["unknown"], null);

            target.PopFrame();
            Assert.AreEqual(target["hidden"], "bottom");

            target.PopFrame();
            Assert.AreEqual(target["hidden"], null);
        }
    }
}